﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLNS_Public;
using System.Data;

namespace QLNS_Data
{
   public class ThaiSan_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();

       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_tbl_ThaiSan");
       }
       public DataTable taoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public int update_ThaiSan(ThaiSan_Public maThaiSan, ThaiSan_Public maNhanVien, ThaiSan_Public ngayVeSom, ThaiSan_Public ngayNghiSinh, ThaiSan_Public ngayLamTroLai, ThaiSan_Public troCapCongTy, ThaiSan_Public ghiChu)
       {
           int n = 7;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaThaiSan";
           value[0] = maThaiSan.MaThaiSan;
           name[1] = "@MaNhanVien";
           value[1] = maNhanVien.MaNhanVien;
           name[2] = "@NgayVeSom";
           value[2] = ngayVeSom.NgayVeSom;
           name[3] = "@NgayNghiSinh";
           value[3] = ngayNghiSinh.NgayNghiSinh;
           name[4] = "@NgayLamTroLai";
           value[4] = ngayLamTroLai.NgayLamTroLai;
           name[5] = "@TroCapCongTy";
           value[5] = troCapCongTy.TroCapCongTy;
           name[6] = "@GhiChu";
           value[6] = ghiChu.GhiChu;
           return kn.update("Update_ThaiSan",name,value,n);
       }
       public int insert_ThaiSan(ThaiSan_Public maNhanVien, ThaiSan_Public ngayVeSom, ThaiSan_Public ngayNghiSinh, ThaiSan_Public ngayLamTroLai, ThaiSan_Public troCapCongTy, ThaiSan_Public ghiChu)
       {
           int n = 6;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaNhanVien";
           value[0] = maNhanVien.MaNhanVien;
           name[1] = "@NgayVeSom";
           value[1] = ngayVeSom.NgayVeSom;
           name[2] = "@NgayNghiSinh";
           value[2] = ngayNghiSinh.NgayNghiSinh;
           name[3] = "@NgayLamTroLai";
           value[3] = ngayLamTroLai.NgayLamTroLai;
           name[4] = "@TroCapCongTy";
           value[4] = troCapCongTy.TroCapCongTy;
           name[5] = "@GhiChu";
           value[5] = ghiChu.GhiChu;
           return kn.update("Insert_ThaiSan", name, value, n);
       }
       public int delete_ThaiSan(ThaiSan_Public maThaiSan)
       {
           int n = 1;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaThaiSan";
           value[0] = maThaiSan.MaThaiSan;
           return kn.update("Delete_ThaiSan", name, value, n);
       }
    }
}
